import { useEffect, useRef } from "react";

/**
 * 初次不渲染
 */

export const useUpdateEffect = (
  callback: Function,
  deps: React.DependencyList
) => {
  const isFirstRender = useRef<boolean>(true);

  useEffect(() => {
    if (!isFirstRender.current) {
      return callback();
    } else {
      isFirstRender.current = false;
    }
  }, deps);

  return;
};
